package minidb.semantic;
import minidb.parse.exps.*;

public class SemanticChecker
{
	public static Boolean DoSemanticCheck(SQLExp exp) throws SemanticException
	{
		if(CreateTableExp.class.isInstance(exp))
			return (new CreateTableChecker((CreateTableExp)exp)).DoSemanticCheck();
		else if(SelectExp.class.isInstance(exp))
			return (new SelectChecker((SelectExp)exp)).DoSemanticCheck();
		else if(InsertExp.class.isInstance(exp))
			return (new InsertChecker((InsertExp)exp)).DoSemanticCheck();
		else if(UpdateExp.class.isInstance(exp))
			return (new UpdateChecker((UpdateExp)exp)).DoSemanticCheck();
		else if(DeleteExp.class.isInstance(exp))
			return (new DeleteChecker((DeleteExp)exp)).DoSemanticCheck();
		else if(CreateViewExp.class.isInstance(exp))
			return (new CreateViewChecker((CreateViewExp)exp)).DoSemanticCheck();
		else if(CreateIndexExp.class.isInstance(exp))
			return (new CreateIndexChecker((CreateIndexExp)exp)).DoSemanticCheck();
		else if(DropExp.class.isInstance(exp))
			return (new DropChecker((DropExp)exp)).DoSemanticCheck();
		else if(TransactionExp.class.isInstance(exp))
			return (new TransactionChecker((TransactionExp)exp)).DoSemanticCheck();
		else 
			throw new RuntimeException("SemanticChecker.DoSemanticCheck():Unexpected SQLExp type");
	}
}
